package config

import (
	"fmt"
	"gopkg.in/yaml.v3"
	"mall_frontend_api/biz/model/config"
	"os"
)

var Values config.Config

func MustInit() {
	pwd, err := os.Getwd()
	if err != nil {
		panic(err)
	}
	if pwd == "/" {
		pwd = "/go-frontend-api/bin"
	}
	data, err := os.ReadFile(fmt.Sprintf("%s%s", pwd, "/conf/conf.yaml"))
	if err != nil {
		panic(err)
	}

	if err = yaml.Unmarshal(data, &Values); err != nil {
		panic(err)
	}
}
